<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://www.bird.com" prefix="bird"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<bird:getTree></bird:getTree>
	<bird:sellTag></bird:sellTag>
	<head>
		<link rel="stylesheet" href="/Machine/css/dtree.css" type="text/css"></link>
		<script type="text/javascript" src="/Machine/js/dtree.js">
</script>
		<script type="text/javascript" src="/Machine/js/jquery-1.7.2.js">
</script>
		<title>sell</title>

		<link rel="stylesheet" type="text/css" href="/Machine/css/sell.css">

		<script type="text/javascript">
			var json = ${json};
			var tag="${tag}";
			
			$(document).ready(function(){
				for(var i =0; i < json.size; i++){
					
					var tag1 = "#itemname"+i;
					var title = "<a target='_blank' href='/Machine/user/searchComDel.action?id="+json.id[i]+"'> <strong class='px14'>"+json.name[i]+"</strong> </a>";
					$(tag1).html(title);
					
					var tag2 = "#itemdes"+i;   	
					var mes = "供应量 "+json.stock[i]+"  已卖出"+json.sell[i];
					$(tag2).html(mes);
					
					var tag3 = "#itemprice"+i;
					$(tag3).html("价格：<font class='price_num'>"+json.price[i]+"</font> ");
					
					var tag4 = "#itemtime"+i;
					$(tag4).html("发布时间："+json.outtime[i]);
				}

			});
			
			
			function tagsearch(obj){
				
				var tagNum = $(obj).children().html();
				var url = "/Machine/search/keySearch.action?tag="+tagNum+"&orderKey=type&keywords=${sessionScope.keywords}";	
				window.location=url;
			}
			
			function changePrice(obj){
				
				var priceKind = $(obj).val();
				
				var url = "/Machine/search/keySearch.action?tag="+tag+"&orderKey=price"+"&orderValue="+priceKind+"&keywords=${sessionScope.keywords}";
				window.location=url;
			}
			
			function changeSell(obj){
				var sellKind = $(obj).val();
				var url="/Machine/search/keySearch.action?tag="+tag+"&orderKey=sell"+"&orderValue="+sellKind+"&keywords=${sessionScope.keywords}";
				window.location=url;
			}
			
			function changeProvid(obj){
				var proKind = $(obj).val();
				var url="/Machine/search/keySearch.action?tag="+tag+"&orderKey=stockamount"+"&orderValue="+proKind+"&keywords=${sessionScope.keywords}";
				window.location=url;
			}
			
			function changeTime(obj){
				var timeKind = $(obj).val();
				var url="/Machine/search/keySearch.action?tag="+tag+"&orderKey=time"+"&orderValue="+timeKind+"&keywords=${sessionScope.keywords}";
				window.location=url;
			}
			
			
		</script>
	</head>

	<body style="text-align: center;">
		<jsp:include page="header.jsp"></jsp:include>



		<div class="m">
			<div class="m_l_1 f_l">
				<div class="left_box">
					<div class="pos">
						当前位置:
						<a href="">首页</a> »
						<a href="">供应</a>
					</div>


					<div class="category">

						<div style="float: left; margin-bottom: 40px;">

							<table width="100%" cellpadding="0" cellspacing="0">
								<tbody>
									<tr>
										<td>
											<strong>按行业浏览</strong>
										</td>
									</tr>
									<td>
									</td>
									<tr>
									</tr>
									<c:forEach items="${list }" var="item" varStatus="allstatus">

										<tr>
											<c:forEach items="${item }" var="kind" varStatus="status">
												<c:if test="${status.index==1}">
													<tr>

													</tr>
												</c:if>
												<td>
													<c:if test="${status.index==0}">

														<a onclick="tagsearch(this);" class="type_a_big">${kind.key}<font
															style="display: none;">${kind.value}</font> </a>

													</c:if>
													<c:if test="${status.index!=0}">
														<a onclick="tagsearch(this);">${kind.key}<font
															style="display: none;">${kind.value}</font> </a>
													</c:if>

												</td>

											</c:forEach>

										</tr>

									</c:forEach>


								</tbody>

							</table>

						</div>
						<div class="sort_div">
							<div class="sort_fangshi">
								<strong>排序方式</strong>
							</div>

							<div class="sort_select">
								<font>价格:</font>
								<select onchange="changePrice(this);">
									<option value="">
										--------------
									</option>
									<option value="0">
										价格由低到高
									</option>
									<option value="1">
										价格由高到低
									</option>
								</select>
								<font>销量:</font>
								<select onchange="changeSell(this);">
									<option value="">
										--------------
									</option>
									<option value="0">
										销量由低到高
									</option>
									<option value="1">
										销量由高到低
									</option>
								</select>
								<font>供应量:</font>
								<select onchange="changeProvid(this);">
									<option value="">
										--------------
									</option>
									<option value="0">
										供应量由低到高
									</option>
									<option value="1">
										供应量由高到低
									</option>
								</select>
								<font>时间:</font>
								<select onchange="changeTime(this);">
									<option value="">
										--------------
									</option>
									<option value="0">
										时间由早到晚
									</option>
									<option value="1">
										时间由晚到早
									</option>
								</select>
							</div>
						</div>
					</div>

					<div class="type">

					</div>

					<c:forEach items="${count}" varStatus="status">
						<div id="item_2298" class="list">
							<table>
								<tbody>
									<tr align="center">
										<td width="90">
											<div>
												<a target="_blank"
													href=""> <img
														width="80" height="80"
														src="">
												</a>
											</div>
										</td>
										<td width="10">
										</td>

										<td align="left">
											<ul>
												<li>
													<div class="content_title" id="itemname${status.index}">
														<a target="_blank"
															href="/Machine/user/searchComDel.action?id=${item.id}">
															<strong class="px14"></strong> </a>
													</div>
													<div class="content_time" id="itemtime${status.index}">
														发布时间：
													</div>
													<div class="content_n" id="itemdes${status.index}">

													</div>
													<div class="content_price" id="itemprice${status.index}">

														<font class="price_num"></font>
													</div>
												</li>
											</ul>
									</tr>

								</tbody>
							</table>

						</div>


					</c:forEach>

					<table>
						<tr class="odd">
							<td>
								&nbsp;
							</td>
							<td>
								<s:if test="%{pageBean.currentPage == 1}">   
　　　　　　											首页		上一页
　　　　											</s:if>
								<s:else>
									<a href="/Machine/search/keySearch.action?page=1&keywords=<s:property value="#session.keywords"/>">首页</a>
									<a
										href="/Machine/search/keySearch.action?keywords=<s:property value="#session.keywords"/>&page=<s:property value="%{pageBean.currentPage-1}"/>" />上一页</a>

								</s:else>
							</td>
							<td>
								<s:if test="%{pageBean.currentPage != pageBean.totalPage}">

									<a
										href="/Machine/search/keySearch.action?keywords=<s:property value="#session.keywords"/>&page=<s:property value="%{pageBean.currentPage+1}"/>">下一页</a>
									<a
										href="/Machine/search/keySearch.action?keywords=<s:property value="#session.keywords"/>&page=<s:property value="pageBean.totalPage"/>">尾页
									</a>
								</s:if>
								<s:else> 
　　　　　　											下一页	 尾页 
　　　　											</s:else>
							</td>

							<td>
								<div align="center">
									页次
									<s:property value="pageBean.currentPage" />
									/
									<s:property value="pageBean.totalPage" />
									&nbsp;&nbsp;&nbsp;共
									<s:property value="pageBean.allRow" />
									记录
								</div>
								<div align="center"></div>
							</td>
						</tr>
					</table>

				</div>
			</div>
			<div class="m_n f_l">
				&nbsp;
			</div>

			<div class="m_r_1 f_l">
				<div class="box_head_1">
					<div>
						<strong>今日搜索排行</strong>
					</div>
				</div>
				<div class="box_body">
					<div class="rank_list">
						<ul>
						<c:forEach items="${latestSearch }" var="item" varStatus="status">
							<li>
								${status.count}. ${item.key }&nbsp;&nbsp;${item.value }条
							</li>
						</c:forEach>
						<!--  
							<li>
								灌装机&nbsp;&nbsp;12条
							</li>
							<li>
								灌装机&nbsp;&nbsp;5条
							</li>
							<li>
								灌装机&nbsp;&nbsp;2条
							</li>-->
						</ul>

					</div>
				</div>

			</div>

		</div>

		<jsp:include page="footer.jsp"></jsp:include>
	</body>
</html>
